package cn.tannn.ops.message.entity.converter;

import cn.tannn.ops.message.constant.WebHookSecretType;
import jakarta.persistence.AttributeConverter;
import jakarta.persistence.Converter;

/**
 * WebHookSignType
 *
 * @author <a href="https://t.tannn.cn/">tan</a>
 * @version V1.0
 * @date 2024/8/23 上午10:51
 */
@Converter(autoApply = true)
public class WebHookSecretTypeConverter implements AttributeConverter<WebHookSecretType,String> {
    @Override
    public String convertToDatabaseColumn(WebHookSecretType attribute) {
        return attribute.getName();
    }

    @Override
    public WebHookSecretType convertToEntityAttribute(String dbData) {
        return WebHookSecretType.fromName(dbData);
    }
}
